package day1004;

/**
 * @Author:galaxy_yan
 * @Date: 2022/10/5
 * @Time: 19:39
 * @Description
 */
public class ArrayListTest {
    public static void main(String[] args) {
        MyArrayList list=new MyArrayList();
        System.out.println("测试add方法：");
        list.add(12);
        list.add(23);
        list.add(34);
        list.add(45);
        list.add(56);
        list.add(67);
        list.display();
        System.out.println("在数组头部添加元素：");
        list.add(1,11);
        System.out.println("在数组中间添加元素：");
        list.add(4,44);
        System.out.println("在数组末尾添加元素：");
        list.add(6,66);
        list.display();
        System.out.println("======================================");
        System.out.println("测试contains方法：");
        System.out.println(list.contains(55));
        System.out.println(list.contains(44));
        System.out.println("======================================");
        System.out.println("测试indexOf方法：");
        System.out.println(list.indexOf(34));
        System.out.println(list.indexOf(22));
        System.out.println("======================================");
        System.out.println("测试get方法：");
        System.out.println(list.get(5));
        System.out.println("======================================");
        System.out.println("测试isEmpty方法：");
        System.out.println(list.isEmpty());
        System.out.println("======================================");
        System.out.println("测试set方法：");
        list.set(2,222);
        list.display();
        System.out.println("======================================");
        System.out.println("测试remove方法：");
        System.out.println("删除第一个元素:");
        list.remove(12);
        System.out.println("删除中间元素:");
        list.remove(44);
        System.out.println("删除最后一个元素:");
        list.remove(67);
        list.display();

    }
}
